<template>
  <van-row class="card">
    <van-col :span="6">
      <img :src="data.cardImg" alt="">
    </van-col>
    <van-col :span="18" class="rightContent">
      <van-row>
        <van-col :span="12" class="cardTitle">
          <!-- <van-badge :title="data.cardTitle" info="8" /> -->
          {{data.cardTitle}}
          <span v-if="data.cardNum" class="num">{{data.cardNum || ''}}</span>
          <span v-if="data.cardDot" class="dotNum"></span>
        </van-col>
        <van-col :span="12" class="cardTime" v-if="data.cardTime">
          <span>{{data.cardTime || ''}}</span>
        </van-col>
      </van-row>
      <p>{{data.cardQuistion}}</p>
      <p>{{data.cardDesc}}</p>
      <div class="btn" v-if="isBtn">
        <van-button type="info" size="small" @click="onDeal">前往处理</van-button>
      </div>
    </van-col>
  </van-row>
</template>

<script>
  export default {
    props: ['cardType', 'data', 'isBtn'],
    data() {
      return {
      }
    },
    methods:{
      // 点击处理任务按钮
      onDeal() {
        if (this.cardType === 'task') {
          this.$router.push({
            name: 'RectificationTask',
            params: {
              itemData: this.data
            }
          })
        }
      }
    }
  }
</script>

<style scoped lang="scss">
  .card{
    padding: 0.625rem;
    font-size: 0.875rem;
    border-top: 0.0625rem solid #ececec;
    .rightContent{
      padding: 0.3125rem;
      .cardTitle{
        font-size: 1rem;
        font-weight: bold;
        position: relative;
        .dotNum{
          font-size: 0.75rem;
          position: absolute;
          top: -0.3125rem;
          right: -1.25rem;
          width: 0.625rem;
          height: 0.625rem;
          text-align: center;
          line-height: 1.25rem;
          color: #fff;
          background-color: #f00;
          border-radius: 50%;
        }
        .num{
          font-size: 0.75rem;
          position: absolute;
          top: -0.3125rem;
          right: -1.25rem;
          width: 1.25rem;
          height: 1.25rem;
          text-align: center;
          line-height: 1.25rem;
          color: #fff;
          background-color: #f00;
          border-radius: 50%;
        }
      }
      .cardTime{
        text-align: right;
      }
      .btn{
        text-align: right;
      }
      p{
        color: #999;
        margin: 0.3125rem 0;
      }
    }
    img{
      width: 100%;
    }
  }
</style>
